package com.runshu.newsmartark.mvp.presenter;


import com.runshu.newsmartark.mvp.contract.RegisterAndRecognContract;
import com.runshu.newsmartark.network.netbean.ResponseBean;
import com.runshu.newsmartark.network.netinterface.MyCallBack;

/**
 * Demo class
 *
 * @author yu
 * @date 2020/7/29
 * @decs：
 */

public class RegisterAndRecognPresenter implements RegisterAndRecognContract.Presenter {
    private RegisterAndRecognContract.View view;
    private RegisterAndRecognContract.Model model;

    public RegisterAndRecognPresenter(RegisterAndRecognContract.View view, RegisterAndRecognContract.Model model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void addUserFace(String usercode, String facecode) {
        model.addUserFace(usercode, facecode, new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.addUserFaceSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.OnaddUserFaceError(data.getMessage());
            }
        });

    }

    @Override
    public void verifyUserFace(String facecode) {

        model.verifyUserFace(facecode, new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.verifyUserFaceSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.OnverifyUserFaceError(data.getMessage());
            }
        });


    }
}